﻿using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;

namespace AuSys.Database.Context.Specific
{
    public class DataSqliteTempContext(
        DataContextOptions options
        ) : DataSqliteContext(options)
    {
        public new const string dbType = "sqlitetemp";
        public override string AcceptDbType => dbType;
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (_options.ConnStr == ":memory:")
            {
                var conn = new SqliteConnection(_options.ConnStr);
                conn.Open();
                optionsBuilder.UseSqlite(conn);
            }
            else
                base.OnConfiguring(optionsBuilder);
        }
    }
}
